import greenfoot.*;

/**
 * This class defines a crab. Crabs live on the beach.
 */
public class Crab extends Actor
{
    public void act()
    {  
       move(3);
       if(isAtEdge() ==true){
           turn(15);
       }
       keyControl();
       removeTouching(Worm.class);
    }
    public void keyControl(){
       if(Greenfoot.isKeyDown("left")){
           turn(-15);
       }
       if(Greenfoot.isKeyDown("right")){
           turn(15);
       }
    }
}


